//
//  SecondView.swift
//  NavigationDemo
//
//  Created by hongyan.yang on 2022/4/15.
//
import SwiftUI

struct SecondView: View {
    @EnvironmentObject var navigation: Navigation
    @Environment(\.presentationMode) var presentationMode: Binding<PresentationMode>
    @State var thirdViewShowing = false
    var body: some View {
        VStack{
            Text("2nd View")
            NavigationLink(destination: ThirdView(), isActive: $thirdViewShowing) {
                Text("3rd view")
            }
        }.navigationToolBar("SecondView", "back") {
            presentationMode.wrappedValue.dismiss()
        }
    }
}

struct SecondView_Previews: PreviewProvider {
    static var previews: some View {
        SecondView()
    }
}
